package com.fh.alipay.model.convert;


import lombok.experimental.UtilityClass;
import com.fh.alipay.po.GoodsImg;
import com.fh.alipay.model.dto.GoodsImgDTO;
import com.fh.alipay.model.vo.GoodsImgVO;
import java.util.ArrayList;
import java.util.List;

/**
 * @author fh
 * @date 2022-05-03
 * @description 商品图片表转换类
 */

@UtilityClass
public class GoodsImgConvert {


    public static GoodsImg toPO(GoodsImgDTO dto){
        GoodsImg result = new GoodsImg();
            result.setId(dto.getId());
            result.setCreateTime(dto.getCreateTime());
            result.setUpdateTime(dto.getUpdateTime());
            result.setGoodsImgName(dto.getGoodsImgName());
            result.setGoodsImgRealName(dto.getGoodsImgRealName());
            result.setGoodsImgUrl(dto.getGoodsImgUrl());
        return result;
    }

    public static GoodsImgVO toVO(GoodsImg po){
        GoodsImgVO result = new GoodsImgVO();
                result.setId(po.getId());
                result.setCreateTime(po.getCreateTime());
                result.setUpdateTime(po.getUpdateTime());
                result.setGoodsImgName(po.getGoodsImgName());
                result.setGoodsImgRealName(po.getGoodsImgRealName());
                result.setGoodsImgUrl(po.getGoodsImgUrl());
            return result;
    }
    public static List<GoodsImgVO> toVO(List<GoodsImg> pos){
        if(pos == null){
            return null;
        }
        List<GoodsImgVO> list = new ArrayList<>();
        for(GoodsImg po:pos){
            list.add(toVO(po));
        }
        return list;
    }

    public static List<GoodsImg> toPO(List<GoodsImgDTO> dtos){
        if(dtos == null) {
            return null;
        }
        List<GoodsImg> list = new ArrayList<>();
        for(GoodsImgDTO dto:dtos) {
            list.add(toPO(dto));
        }
        return list;
    }


}
